{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Monte Carlo Simulation with Python\n",
    "\n",
    "Notebook to accompany article on [Practical Business Python](https://pbpython.com/monte-carlo.html)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import seaborn as sns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "sns.set_style('whitegrid')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Define the variables for the Percent to target based on historical results\n",
    "avg = 1\n",
    "std_dev = .1\n",
    "num_reps = 500\n",
    "num_simulations = 1000"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Show an example of calculating the percent to target\n",
    "pct_to_target = np.random.normal(avg, std_dev, num_reps).round(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1.06, 1.27, 0.85, 0.91, 0.89, 1.18, 1.03, 0.83, 0.99, 0.89])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pct_to_target[0:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Another example for the sales target distribution\n",
    "sales_target_values = [75_000, 100_000, 200_000, 300_000, 400_000, 500_000]\n",
    "sales_target_prob = [.3, .3, .2, .1, .05, .05]\n",
    "sales_target = np.random.choice(sales_target_values, num_reps, p=sales_target_prob)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([400000, 200000, 100000, 200000, 400000, 100000, 300000, 100000,\n",
       "        75000, 200000])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sales_target[0:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Pct_To_Target</th>\n",
       "      <th>Sales_Target</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.06</td>\n",
       "      <td>400000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.27</td>\n",
       "      <td>200000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.85</td>\n",
       "      <td>100000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.91</td>\n",
       "      <td>200000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.89</td>\n",
       "      <td>400000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Pct_To_Target  Sales_Target\n",
       "0           1.06        400000\n",
       "1           1.27        200000\n",
       "2           0.85        100000\n",
       "3           0.91        200000\n",
       "4           0.89        400000"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Show how to create the dataframe\n",
    "df = pd.DataFrame(index=range(num_reps), data={'Pct_To_Target': pct_to_target,\n",
    "                                               'Sales_Target': sales_target})\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fd94422a2e8>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEICAYAAABF82P+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAIABJREFUeJzt3X9cjXf/B/DX6XckU/dOyXrcftzcawxZISyUpCUSNvbANLdoVpIfDyaMKW4zv/YDRzbsNjeSzPIjmqmH3yyM1YaxpXQyqUjnVKfr+4evc2uuOlfpnFOn1/Px8Hg417nO9Xm/O6fr1fXzyARBEEBERPQXZsYugIiIGiYGBBERiWJAEBGRKAYEERGJYkAQEZEoBgQREYliQDQRgYGBOHPmjN7Hyc3Nhbu7OzQazXMtZ/z48di9e3c9VUU1mTt3LjZt2lQvy7p58yY8PDy0j998803s27evXpYNABMmTMCBAwfqbXlUMwaECfDx8cHJkyerTEtMTMTYsWO1j5OTk9GrV68al3P79m3885//REVFRZ1rcXFxQUZGBszNzeu8DF1OnToFHx8f9OvXr8rKori4GCNGjMDDhw+rfe2ZM2fg7e1dp3E3bNgAd3d3uLu749VXX4Wbm5v2cWBgYJ2W+TxWrlyJ+fPn1zhP37590a1bN7i7u8PT0xNvv/02du/ejacvf1q+fDkmT56sc7y+ffvi/PnzNc7Trl07nfNIJdbftm3b8MYbb9TL8kk3C2MXQKajoqICFhb6/0jFxcVhw4YNqKysxIQJE+Dv7w9zc3N88sknmDx5Muzs7PQy7tSpUzF16lQAjwN49+7d2LFjR52XZ6if1+bNm+Hh4YHi4mKcPn0acXFxuHLlChYvXl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ZgyZQri4uJ0zm8yASHU4jYdycnJ8Pf3h7m5ub7Lei5SekpOTsaIESOQlpYGhUKBOXPmoLKy0lAl1omUvubMmYNz584hODgYZ8+ehZOTU6P6K/WvavP5pIbh9OnTSEhIwKxZs4xdSr3x8/PDoUOH8Pnnn2Pt2rU652+8v3F/UZvbdBw4cKDaGwA2JFJ6SkhIQHx8PADA3d0darUa9+/fh6Ojo0FrrQ0pfTk5OeGzzz4DAJSUlCAlJQUtWrQwaJ316a895+XlNYrdgU1VVlYWYmJisGnTJrRq1crY5dQ7T09P/PHHHygoKICDg0O185nMFoTU23T89ttvKC4uhru7uxGqrB0pPbVu3RqnTp0C8Hi/vVqtrvENbwik9FVQUKDdElIoFBg5cqQxSq03Pj4+SEpKgiAIuHjxIlq0aMGAaKByc3MRERGBFStWoF27dsYup978/vvv2i3Zq1evory8XGf4mdSV1MePH0dcXJz2Nh3h4eFYu3YtunTpAl9fXwDAp59+CrVa3Wg2G3X1dP36dcTExODRo0eQyWSYPXs2+vXrZ+yyddLV16FDh7Bq1SrIZDJ4eHhg0aJFsLKyMnbZ1YqOjsbZs2e1W28RERGoqKgAAIwdOxaCIGDJkiVIT0+Hra0t4uLi8Oqrrxq5at109XX37l2MHDkSDx8+hJmZGZo1a4YDBw7Azs7OyJVXT1dP8+fPR0pKClxcXAAA5ubmSExMNGbJkujqS6FQYN++fbCwsICNjQ1mz56t81R/kwoIIiKqPyazi4mIiOoXA4KIiEQxIIiISBQDgoiIRDEgiIhIFAOCiIhEMSCIiEjU/wFAxr7T/KCx8gAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7fd946321a20>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Simple histogram to confirm distribution looks as expected\n",
    "df['Pct_To_Target'].plot(kind='hist', title='Historical % to Target Distribution')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fd9441fc668>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEICAYAAABF82P+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAIABJREFUeJzt3XtUlHX+B/D3AAIKSqINoD/Xlg6WaSoGKSCagwPhMIKKmac0J9wUDVC6eUlNw7ROecl0la12aTO3UsIKSwRvpFtawiFrKt0kr8wYVwEZbt/fHyzPSjyDIzrMKO/XOZ4z830u38/zFebNcx2FEEKAiIjoDxxsXQAREdknBgQREcliQBARkSwGBBERyWJAEBGRLAYEERHJYkDcxjQaDb755hur93PhwgX4+/ujoaHhhtYzffp0fPzxxzepqv/ZuHEjnn322Zu+3tvNjBkzsHv37puyriNHjmDChAnS+5CQEHz77bc3Zd0AMG7cOOTl5d209ZE8BsQtSqVS4ciRIy3a0tPTMW3aNOl9ZmYmRowY0eZ6zp07h3vuuQf19fXtrqVPnz7Iy8uDo6Nju9dxLRUVFVi0aBFCQkLg7++PiIgIpKamWq2/tixbtgz+/v7w9/fH4MGDMWjQIOn9rFmzOryeBQsWYPPmzWanm0wm3HPPPRg2bBj8/f0xYsQI6HQ6ZGVltZjvvffew/jx49vsq3ldRUVFbc4XHByMTz/91PKNaIPc9mVnZ8Pf3/+mrJ/Mc7J1AXRrq6+vh5OT9X+MVq9ejerqauzevRvdu3fH6dOncfLkSav3K2flypVYuXIlgKa9k99++w2vv/56u9fX0NBg1XBt9uWXX8Lb2xslJSXYt28fXnzxRRQWFuKpp566qf101M8EWR/3IG5jV+9lFBQUYNKkSRg+fDiCg4OxevVqAMDjjz8OAAgMDIS/vz/y8vLQ2NiIzZs3Y+zYsQgKC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eLgICwsTmzdvltrN9WGPvv76a+kqJo5NkzNnzgitViu0Wq0YP368VL89/m7xURtERCSLh5iIiEgWA4KIiGQxIIiISBYDgoiIZDEgiIhIFgOCiIhkMSCIiEjW/wMCRGS48ioFJgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7fd944250748>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Look at the sales target distribution\n",
    "df['Sales_Target'].plot(kind='hist', title='Historical Sales Target Distribution')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Back into the actual sales amount\n",
    "df['Sales'] = df['Pct_To_Target'] * df['Sales_Target']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "def calc_commission_rate(x):\n",
    "    \"\"\" Return the commission rate based on the table:\n",
    "    0-90% = 2%\n",
    "    91-99% = 3%\n",
    "    >= 100 = 4%\n",
    "    \"\"\"\n",
    "    if x <= .90:\n",
    "        return .02\n",
    "    if x <= .99:\n",
    "        return .03\n",
    "    else:\n",
    "        return .04"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "df['Commission_Rate'] = df['Pct_To_Target'].apply(calc_commission_rate)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Pct_To_Target</th>\n",
       "      <th>Sales_Target</th>\n",
       "      <th>Sales</th>\n",
       "      <th>Commission_Rate</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.06</td>\n",
       "      <td>400000</td>\n",
       "      <td>424000.0</td>\n",
       "      <td>0.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.27</td>\n",
       "      <td>200000</td>\n",
       "      <td>254000.0</td>\n",
       "      <td>0.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.85</td>\n",
       "      <td>100000</td>\n",
       "      <td>85000.0</td>\n",
       "      <td>0.02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.91</td>\n",
       "      <td>200000</td>\n",
       "      <td>182000.0</td>\n",
       "      <td>0.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.89</td>\n",
       "      <td>400000</td>\n",
       "      <td>356000.0</td>\n",
       "      <td>0.02</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Pct_To_Target  Sales_Target     Sales  Commission_Rate\n",
       "0           1.06        400000  424000.0             0.04\n",
       "1           1.27        200000  254000.0             0.04\n",
       "2           0.85        100000   85000.0             0.02\n",
       "3           0.91        200000  182000.0             0.03\n",
       "4           0.89        400000  356000.0             0.02"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Calculate the commissions\n",
    "df['Commission_Amount'] = df['Commission_Rate'] * df['Sales']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Pct_To_Target</th>\n",
       "      <th>Sales_Target</th>\n",
       "      <th>Sales</th>\n",
       "      <th>Commission_Rate</th>\n",
       "      <th>Commission_Amount</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.06</td>\n",
       "      <td>400000</td>\n",
       "      <td>424000.0</td>\n",
       "      <td>0.04</td>\n",
       "      <td>16960.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.27</td>\n",
       "      <td>200000</td>\n",
       "      <td>254000.0</td>\n",
       "      <td>0.04</td>\n",
       "      <td>10160.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.85</td>\n",
       "      <td>100000</td>\n",
       "      <td>85000.0</td>\n",
       "      <td>0.02</td>\n",
       "      <td>1700.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.91</td>\n",
       "      <td>200000</td>\n",
       "      <td>182000.0</td>\n",
       "      <td>0.03</td>\n",
       "      <td>5460.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.89</td>\n",
       "      <td>400000</td>\n",
       "      <td>356000.0</td>\n",
       "      <td>0.02</td>\n",
       "      <td>7120.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Pct_To_Target  Sales_Target     Sales  Commission_Rate  Commission_Amount\n",
       "0           1.06        400000  424000.0             0.04            16960.0\n",
       "1           1.27        200000  254000.0             0.04            10160.0\n",
       "2           0.85        100000   85000.0             0.02             1700.0\n",
       "3           0.91        200000  182000.0             0.03             5460.0\n",
       "4           0.89        400000  356000.0             0.02             7120.0"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "87970500.0 3017002.5 87850000\n"
     ]
    }
   ],
   "source": [
    "print(df['Sales'].sum(), df['Commission_Amount'].sum(), df['Sales_Target'].sum())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Pct_To_Target</th>\n",
       "      <th>Sales_Target</th>\n",
       "      <th>Sales</th>\n",
       "      <th>Commission_Rate</th>\n",
       "      <th>Commission_Amount</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>500.000000</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>1.000760</td>\n",
       "      <td>175700.000000</td>\n",
       "      <td>175941.000000</td>\n",
       "      <td>0.033600</td>\n",
       "      <td>6034.005000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.098028</td>\n",
       "      <td>121703.053645</td>\n",
       "      <td>123823.050417</td>\n",
       "      <td>0.007613</td>\n",
       "      <td>4745.301127</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>0.710000</td>\n",
       "      <td>75000.000000</td>\n",
       "      <td>58500.000000</td>\n",
       "      <td>0.020000</td>\n",
       "      <td>1170.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>0.930000</td>\n",
       "      <td>75000.000000</td>\n",
       "      <td>82500.000000</td>\n",
       "      <td>0.030000</td>\n",
       "      <td>2932.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>1.005000</td>\n",
       "      <td>100000.000000</td>\n",
       "      <td>108000.000000</td>\n",
       "      <td>0.040000</td>\n",
       "      <td>4180.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>1.070000</td>\n",
       "      <td>200000.000000</td>\n",
       "      <td>228000.000000</td>\n",
       "      <td>0.040000</td>\n",
       "      <td>8415.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>1.280000</td>\n",
       "      <td>500000.000000</td>\n",
       "      <td>620000.000000</td>\n",
       "      <td>0.040000</td>\n",
       "      <td>24800.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Pct_To_Target   Sales_Target          Sales  Commission_Rate  \\\n",
       "count     500.000000     500.000000     500.000000       500.000000   \n",
       "mean        1.000760  175700.000000  175941.000000         0.033600   \n",
       "std         0.098028  121703.053645  123823.050417         0.007613   \n",
       "min         0.710000   75000.000000   58500.000000         0.020000   \n",
       "25%         0.930000   75000.000000   82500.000000         0.030000   \n",
       "50%         1.005000  100000.000000  108000.000000         0.040000   \n",
       "75%         1.070000  200000.000000  228000.000000         0.040000   \n",
       "max         1.280000  500000.000000  620000.000000         0.040000   \n",
       "\n",
       "       Commission_Amount  \n",
       "count         500.000000  \n",
       "mean         6034.005000  \n",
       "std          4745.301127  \n",
       "min          1170.000000  \n",
       "25%          2932.500000  \n",
       "50%          4180.000000  \n",
       "75%          8415.000000  \n",
       "max         24800.000000  "
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Show Full Example of the simulation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Define a list to keep all the results from each simulation that we want to analyze\n",
    "all_stats = []\n",
    "\n",
    "# Loop through many simulations\n",
    "for i in range(num_simulations):\n",
    "    \n",
    "    # Choose random inputs for the sales targets and percent to target\n",
    "    sales_target = np.random.choice(sales_target_values, num_reps, p=sales_target_prob)\n",
    "    pct_to_target = np.random.normal(avg, std_dev, num_reps).round(2)\n",
    "    \n",
    "    # Build the dataframe based on the inputs and number of reps\n",
    "    df = pd.DataFrame(index=range(num_reps), data={'Pct_To_Target': pct_to_target,\n",
    "                                                   'Sales_Target': sales_target})\n",
    "    \n",
    "    # Back into the sales number using the percent to target rate\n",
    "    df['Sales'] = df['Pct_To_Target'] * df['Sales_Target']\n",
    "    \n",
    "    # Determine the commissions rate and calculate it\n",
    "    df['Commission_Rate'] = df['Pct_To_Target'].apply(calc_commission_rate)\n",
    "    df['Commission_Amount'] = df['Commission_Rate'] * df['Sales']\n",
    "    \n",
    "    # We want to track sales,commission amounts and sales targets over all the simulations\n",
    "    all_stats.append([df['Sales'].sum().round(0), \n",
    "                      df['Commission_Amount'].sum().round(0), \n",
    "                      df['Sales_Target'].sum().round(0)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "results_df = pd.DataFrame.from_records(all_stats, columns=['Sales', 'Commission_Amount', 'Sales_Target'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "</style>  \n",
       "<table id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09\" > \n",
       "<thead>    <tr> \n",
       "        <th class=\"blank level0\" ></th> \n",
       "        <th class=\"col_heading level0 col0\" >Sales</th> \n",
       "        <th class=\"col_heading level0 col1\" >Commission_Amount</th> \n",
       "        <th class=\"col_heading level0 col2\" >Sales_Target</th> \n",
       "    </tr></thead> \n",
       "<tbody>    <tr> \n",
       "        <th id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09level0_row0\" class=\"row_heading level0 row0\" >count</th> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row0_col0\" class=\"data row0 col0\" >1,000.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row0_col1\" class=\"data row0 col1\" >1,000.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row0_col2\" class=\"data row0 col2\" >1,000.0</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09level0_row1\" class=\"row_heading level0 row1\" >mean</th> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row1_col0\" class=\"data row1 col0\" >83,709,161.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row1_col1\" class=\"data row1 col1\" >2,858,654.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row1_col2\" class=\"data row1 col2\" >83,702,875.0</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09level0_row2\" class=\"row_heading level0 row2\" >std</th> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row2_col0\" class=\"data row2 col0\" >2,757,247.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row2_col1\" class=\"data row2 col1\" >102,738.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row2_col2\" class=\"data row2 col2\" >2,731,060.0</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09level0_row3\" class=\"row_heading level0 row3\" >min</th> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row3_col0\" class=\"data row3 col0\" >74,279,750.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row3_col1\" class=\"data row3 col1\" >2,509,105.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row3_col2\" class=\"data row3 col2\" >74,725,000.0</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09level0_row4\" class=\"row_heading level0 row4\" >25%</th> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row4_col0\" class=\"data row4 col0\" >81,792,875.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row4_col1\" class=\"data row4 col1\" >2,790,037.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row4_col2\" class=\"data row4 col2\" >81,800,000.0</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09level0_row5\" class=\"row_heading level0 row5\" >50%</th> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row5_col0\" class=\"data row5 col0\" >83,796,250.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row5_col1\" class=\"data row5 col1\" >2,858,382.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row5_col2\" class=\"data row5 col2\" >83,625,000.0</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09level0_row6\" class=\"row_heading level0 row6\" >75%</th> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row6_col0\" class=\"data row6 col0\" >85,533,000.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row6_col1\" class=\"data row6 col1\" >2,925,028.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row6_col2\" class=\"data row6 col2\" >85,600,000.0</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09level0_row7\" class=\"row_heading level0 row7\" >max</th> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row7_col0\" class=\"data row7 col0\" >93,342,750.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row7_col1\" class=\"data row7 col1\" >3,240,805.0</td> \n",
       "        <td id=\"T_732b5980_3305_11e9_b57a_507b9d5f4b09row7_col2\" class=\"data row7 col2\" >92,800,000.0</td> \n",
       "    </tr></tbody> \n",
       "</table> "
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x7fd944151be0>"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results_df.describe().round(0).style.format('{:,}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fd943b3f940>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEICAYAAABF82P+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0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+fj7y8PPj6+tb60R0qlQq9evXCjh07ANx6Ebr9kR5arVY6u2DHjh144YUXoFKpZMd47rnnZHMOGDAABw8eBACcO3cOZrMZrVq1srmcAPDzzz/D29u7xu6qEjnPnTuH9evX35NRo9EgKysLAHDw4EHpMJhWq0VKSgqEEDh+/DiaN28OjUaDPn36YN++fSgvL0d5eTn27duHPn36QKPRoFmzZjh+/DiEEEhJSUFwcHCNdQGQnX7nGE899ZTstiwuLgYAVFdX4/PPP8crr7yi2LY8e/astJ2MRiN+/vlnPP300w3yWGrI7KWlpdL7Ordzent7ozZK3eeOjo6yOTds2IB9+/bhk08+gYODg+I5rfK5dQ35jndDOXTokOjYsaMIDw8XgwYNEoMGDRK7d+8Wb7/9tggPDxfh4eHin//8pzAYDNIyy5YtE8HBwSIkJEQ6A0CIW+/2h4SEiODgYLFs2TJp+vnz58XQoUPFgAEDxIQJE6QzjoxGo5gwYYIYMGCAGDp0qDh//nytY9SW02QyicmTJwu9Xi+ioqLEzz//bJM5hRDivffeE2vWrLnnPmjsnF988YVsxkOHDonBgweLiIgIMWzYMHHixAkhhBDV1dVi5syZIjg4WISHh0tnQAlx6yyiAQMGiAEDBoiNGzdK07Ozs4VerxfBwcFi1qxZorq6WgghRElJiRg1apTQ6XRi1KhRorS0tNYxatuW33zzjQgJCREhISHio48+ktatxLZctWqViIyMFOHh4UKv10tnpzXEY6khs+fk5MjmXLlypejbt6/o1KmTCAwMFFOnTlX0Pq8tZ6dOnURwcLD0OLg9Xamc1sCP2iAiIlk2eYiJiIiUx4IgIiJZLAgiIpLFgiAiIlksCCIiksWCICIiWSwIIiKS9f8A2/1FVGd7XqAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7fd9847f7b70>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "results_df['Commission_Amount'].plot(kind='hist', title=\"Total Commission Amount\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fd943b11630>"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEJCAYAAACOr7BbAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAHSBJREFUeJzt3X1QVXXix/HP5SoPgqHQAGauLq1uLKbmZOND6XoZdBRZ0cS2nZwkW2fUQGNzszJ8KB+mPyqn3dVcZ8rMnAoNW8kRxcQ0y57MJ2zTjQ01Lg6ilsJF8Pz+cL0/yaMckXPuVd+vmWa4h3Pv9+PpnvvhPF6XYRiGAAD4hZBABwAABCcKAgBgioIAAJiiIAAApigIAIApCgIAYIqCAACYoiAAAKYoCACAqVaBDnAtdu3apbCwMEfG8vl8jo3VHOS7NuRrvmDOJpHvcmP26tWryfmu64IICwtTUlKSI2OVlpY6NlZzkO/akK/5gjmbRL7LjWkFu5gAAKYoCACAKQoCAGCKggAAmKIgAACmKAgAgCkKAgBgioIAAJiiIAAApigIwCa1Zxta7LWu5krblhwXN7fr+lYbQDALb+1WlxmFjo9btjDN8TFxY2ILAgBgioIAAJiiIAAApigIAIApCgIAYIqCAACYoiAAAKYoCACAKQoCAGDKtoL48ccfNW7cOA0bNkxpaWlavny5JOnVV1/V/fffr5EjR2rkyJEqKSnxP+e1115Tamqqhg4dqo8//tiuaAAAC2y71Ybb7daMGTOUnJysn3/+WQ888IAGDBggSRo/frwmTJjQaP6DBw+qsLBQhYWF8nq9ysrK0oYNG+R2u+2KCAC4Atu2IOLi4pScnCxJioqKUmJiorxe72XnLy4uVlpamkJDQ9WpUyd17txZu3fvtiseAKAJjtys7/DhwyotLVXPnj311VdfaeXKlS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rdPDgQVvGutr25UplADeboNqC2L17tzp37qxOnTpJktLS0lRcXKzf/OY3LT7Wjd78AHCtgmoLwuv1KiEhwf84Pj5eXq83gIkA4OblMgzDCHSIC9avX69t27Zp3rx5kqSCggLt2bNHzz33nOn8u3btUlhYmJMRAeC65/P51KtXrybnC6pdTAkJCaqoqPA/9nq9iouLu+z8Vv6BAIDmCapdTHfddZfKyspUXl6uuro6FRYWyuPxBDoWANyUgmoLolWrVsrLy9Njjz2mhoYGPfDAA+ratWugYwHATSmojkEAAIJHUO1iAgAEDwoCAGAqqI5BBMJ//vMfPfHEE/7H5eXlysnJ0fjx4/3TPvvsM02ePFm33367JCk1NVWPP/64JHtvDWIl27Jly/Svf/1L0vkr0Q8dOqQdO3aoXbt28ng8ioyMVEhIiNxut9asWdNi2S5444039N5778nlcqlbt25asGBBo1OP6+rq9Ne//lX79u1Tu3bt9PLLL/uX42uvvab8/HyFhIRo5syZuv/++x3P9/rrr+u9996T2+1WTEyM5s+fr44dO0o6f/V8t27dJEkdOnTQkiVLHM+3Zs0avfjii4qPj5ckPfzww8rMzJQkvf/++1q8eLEkadKkSRo1apTj+ebPn6/PPvtMklRbW6uqqip98cUXkpxZfsuXL9d7770nwzCUmZnZaN2QJMMwNG/ePJWUlCg8PFwLFy5UcnKyJGeWX1P5PvjgA/3zn/+UJEVGRmr27Nm68847JcmR9bdJBvzq6+uN/v37G4cPH240/dNPPzUmTpxoOn9KSorxww8/GD6fz0hPTze+++47R7NdrLi42Bg3bpz/8eDBg42qqipb8hiGYVRUVBiDBw82ampqDMMwjJycHGP16tWN5nnrrbeM5557zjAMw1i3bp0xdepUwzAM47vvvjPS09MNn89n/PDDD0ZKSopRX1/veL4dO3YYZ86cMQzDMFauXOnPZxiG0atXrxbN05x8q1evNubMmXPJc6urqw2Px2NUV1cbJ06cMDwej3HixAnH813szTffNGbMmOF/bPfy+/bbb420tDTjzJkzxtmzZ41HHnnE+P777xvNs2XLFmPChAnGuXPnjK+//toYM2aMYRjO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XffPNN5ozZ47efPNN/+/NbqRoFQUBANep06dP6+uvv/bfCUCS/xYnF5jdSNEqCgIArlOGYeiWW27R2rVrLzvPhx9+qLy8vGa9PscgAOA6FRUVpdtvv13r16+XdL4wDhw44P+92Y0UrwZnMQHAdSI3N1c7d+5UdXW1YmNjlZ2drb59+2r27Nk6duyY6uvrNXz4cD3++OOSpFdffVU+n09PPvlks8ajIAAAptjFBAAwRUEAAExREAAAUxQEAMAUBQEAMEVBAABMURAAAFMUBADA1P8B3pZH5SXn6QQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7fd943af39b0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "results_df['Sales'].plot(kind='hist')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
